home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Visual Database / Visual dBase Pro v7.0 / DATA1.CAB / Sample_dBASE / Fleet / Ftree.pop < prev    next >
Encoding:
Text File  |  1997-11-20  |  2.1 KB  |  70 lines

  1. ** END HEADER -- do not remove this line
  2. //
  3. // Generated on 09/18/97
  4. //
  5. parameter formObj, popupName
  6. new FtreePOPUP(formObj, popupName)
  7.  
  8. class FtreePOPUP(formObj, popupName) of POPUP(formObj, popupName)
  9.    with (this)
  10.       left = 0
  11.       top = 0
  12.       trackRight = true
  13.    endwith
  14.  
  15.  
  16.    this.MENUEDIT = new MENU(this)
  17.    with (this.MENUEDIT)
  18.       onClick = class::MENUEDIT_ONCLICK
  19.       text = "Edit..."
  20.    endwith
  21.  
  22.    this.MENUDELETE = new MENU(this)
  23.    with (this.MENUDELETE)
  24.       onClick = class::MENUDELETE_ONCLICK
  25.       text = "Delete..."
  26.    endwith
  27.  
  28.  
  29.    // {Linked Method} form.root.menuedit.onClick
  30.    function MENUEDIT_onClick
  31.       local thisForm, item, bRead
  32.       thisForm = this.parent.parent
  33.       item     = thisForm.fleetTree.selected
  34.       bRead    = false
  35.       if ( TYPE("this.parent.parent.app") == "O" )
  36.          bRead := thisForm.app.openScheduleAsDialog( item )
  37.       endif
  38.    return ( bRead )
  39.  
  40.    // {Linked Method} form.root.menudelete.onClick
  41.    function MENUDELETE_onClick
  42.       local item, bDelete, q
  43.       item     = this.parent.parent.fleetTree.selected
  44.       bDelete  = false
  45.       if ( TYPE("this.parent.parent.app") == "O" )
  46.          if ( MSGBOX("You are about to delete the selected flight." ;
  47.                 + CHR(13) ;
  48.                 + "Click Yes to delete the selected flight from the schedule.", ;
  49.                   "Alert", ;
  50.                   4) == 6 )
  51.             q = new Query()
  52.             with ( q )
  53.                database := this.parent.parent.qFTree.database
  54.                sql      := 'select * from "schedule.dbf" schedule'
  55.                active   := true
  56.             endwith
  57.             q.rowset.applyLocate('"Flight Date" = ' + item.sFlightDate + ;
  58.                ' and "Flight ID" = '   + INT(VAL( item.sFlightID ) ) + ;
  59.                ' and "Aircraft ID" = ' + INT(VAL( item.sAircraftID ) ) )
  60.             if ( not q.rowset.endOfSet )
  61.                bDelete := q.rowset.delete()
  62.                item.release()
  63.             endif
  64.             q.active := false
  65.          endif
  66.       endif
  67.    return ( bDelete )
  68.          
  69. endclass
  70.